dy-lib=libdy.so
static-lib=libmymath.a

.PHONY:all
all:$(dy-lib) $(static-lib)

$(dy-lib):myprintf.o mylog.o
	gcc -shared -o $@ $^

myprintf.o:myprintf.c
	gcc -fPIC -c $^

mylog.o:mylog.c
	gcc -fPIC -c $^

$(static-lib):mymath.o
	ar -rc $@ $^

mymath.o:mymath.c
	gcc -c $^

.PHONY:clean
clean:
	rm -rf *.a *.so *.o lib

.PHONY:output
output:
	mkdir -p lib/include
	mkdir -p lib/mylib
	cp *.h ./lib/include
	mv *.so *.a ./lib/mylib
	rm *.o
